<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>


<script>
    var obj = {
        name: 'zhangtong',
        age: 18
    }
    // obj.gender="男"


    // 1.对象名 2.属性名称 
    Object.defineProperty(obj, 'gender', {
        value: '男',
        // 是否可写
        writable: true,
        // 能否通过遍历得到
        enumerable: true
    })
    console.log(obj)
</script>

</html>